import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login/index.vue'
import Layout from '@/views/layout/index.vue'
import Dashboard from '@/views/dashboard/index.vue'
import Article from '@/views/article/index.vue'

Vue.use(VueRouter)

const routes = [
  // 一级路由规则
  // 登录页
  { path: '/login', component: Login },
  // 系统首页
  { 
    path: '/',
    redirect: '/dashboard',
    component: Layout,
    children: [
      // 二级路由规则
      // 数据看板页
      { path: 'dashboard', component: Dashboard },
      // 文章管理页
      { path: 'article', component: Article }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
